﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfDjackRecommend.aspx.cs" Inherits="msBsc.WebUi.wMall.Seller.wfDjackRecommend" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>地接客推荐信息</title>
    <link href="/themes/wStyle1/css/sLayout.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sHead.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sFoot.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/from.css" rel="stylesheet" />
    <link href="/jqPlugin/kindeditor/themes/default/default.css" type="text/css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/Seller/sDjackRecommend.css" rel="stylesheet" />

    <link href="/themes/wStyle1/css/usermenu.css" rel="stylesheet" />
</head>
<body>
    <div class="wf_all">
        <div id="divLoginInfo">
            <%=msBsc.WebUi.Code.QtHtmlGet.GetHeaderLoginInfo() %>
        </div>
        <div class="main-container">
            <div class="sidebar-scroll">
                <%=msBsc.WebUi.Code.QtHtmlGet.GetDjackMenuHtml() %>
            </div>
            <div class="main-Info">
                <div class="main-menu">
                    <div class="tnavigation">
                        <a class="nav" href="#">我的地接客</a>&gt;
				        <a class="nav" href="#">个人中心</a>&gt;
				        <a class="nav-on" href="#">推荐管理</a>
                        <div class="tinfo right" style="width:70px;">
                            <div class="recommend">
                                <div id="addRecommend" class="recommendButton">添加推荐</div>
                            </div>
                        </div>
                    </div>
                </div>
                <hr />
                <div class="main-horizontal">
                    <div class="span12 recommend">
                        <div id="recommendInfo">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--start JS引用-->
        <script src="/jqPlugin/js/jquery-1.8.3.min.js"></script>
        <script src="/jqPlugin/js/jBase.js"></script>
        <script src="/jqPlugin/js/jBPage.js"></script>
        <script src="/jqPlugin/js/laytpl.js"></script>
        <script src='/??jqPlugin/kindeditor/kindeditor.js,jqPlugin/kindeditor/lang/zh_CN.js'
        type='text/javascript'></script>
        <script src="/themes/wStyle1/js/comm/VerifyJs.js"></script>

        <script src="/jqPlugin/SelectSimu/js/SelectSimu.js"></script>
        <script src="/themes/wStyle1/js/comm/jsLayout.js"></script>
        <!--end JS引用-->
        <script type="text/javascript">

            K = KindEditor;
            //        K.DEBUG = true;
            K.basePath = K.options.basePath = '/jqPlugin/kindeditor/';
            K.options.themesPath = K.options.basePath + 'themes/';
            K.options.langPath = K.options.basePath + 'lang/';
            K.options.pluginsPath = K.options.basePath + 'plugins/';
            function getfilequery() {
                return "&ParentId=" + "&FileId=" + ""
                                        + "&RelId=" + ""
                                        + "&rType1=" + "0"
                                        + "&rType2=" + "0";
            };

            var editorContend;
            function createEditor() {
                editorContend = K.create('#userRecommend', {
                    allowFileManager: true,
                    resizeType: 0,
                    allowPreviewEmoticons: true,
                    allowImageUpload: false,
                    loadStyleMode: false,
                    designMode: true,
                    afterCreate: function () {

                    }
                });
                editorContend.fileManagerJson = '/pgajax.axd?F_MANA=1&rType1=0&rType2=0&COOKATHID=' + (typeof (cookesc) == "undefined" ? "" : cookesc)
                                        + "&fType=" + "mana";
                editorContend.uploadJson = '/pgajax.axd?F_UPLOAD=1&blSave=1&COOKATHID=' + (typeof (cookesc) == "undefined" ? "" : cookesc)
                                        + "&fType=" + "mana"
                                        + getfilequery();
                editorContend.sync("userRecommend");

                $.ploadFile("layer", function (script, textStatus) {
                    //                layer.load('加载中'); 
                });
            }
            var html = "";
            (function () {

                $("#addRecommend").live("click", function () {
                    $(this).hide();
                    html = $("#recommendInfo").html();
                    $("#recommendInfo").html("<div class='form-actions'><textarea class='edit' id='userRecommend' name='content'></textarea><span id='userRecommendMessage' class='help-inline'></span></div><div class='form-actions'><button type='button' class='btn' onclick='saveRecommend(this)' style='margin-right:20px;' ><i class='icon-ok'></i>保 存</button> <button type='button' class='btn' onclick='canceledEidt();' style='margin-right:20px;'><i class='icon-remove'></i>取 消</button></div>");
                    createEditor();
                    //KindEditor.html("#userRecommend", html);
                    editorContend && editorContend.html(html);
                });
            })();

            //取消编辑
            function canceledEidt() {
                $("#recommendInfo").html(html);
                $("#addRecommend").show();
            }

            function doBoundContent(_shopurl) {
                if (_shopurl != null && _shopurl != undefined && _shopurl != '') {
                    jQuery.loadHtml(_shopurl).done(function (_rethtml) {
                        var tpl = HtmlUtil.htmlDecode(_rethtml);
                        $("#recommendInfo").html(tpl);
                    });
                }
            };

            function saveRecommend()
            {
                var userRecommend = editorContend.html();
                if (IsNull(userRecommend)) {
                    alert("旅游推介不能为空")
                    return;
                }
                var opart = new jsonRow();
                opart.AddCell("userRecommend", userRecommend);
                opart.AddCell("ACTION", "saveRecommend");
                ajaxComm(opart);
            }

            function btnDo(sEbtn) {
                GtGrid1Action = sEbtn;
                var opart = GetGtParam();
                ajaxComm(opart);
            };

            //执行AJAX调用时获取参数
            function GetGtParam() {
                var _jsParam = new jsonRow();
                _jsParam.AddCell("ACTION", GtGrid1Action);
                return _jsParam;
            };

            btnDo("init");

            function setDjackInfo(data) {
                var recommendName = "添加推荐";
                if (data.rows[0].ADVICE_HTML_URL != undefined && data.rows[0].ADVICE_HTML_URL != null && data.rows[0].ADVICE_HTML_URL != "") {
                    recommendName = "修改推荐";
                }
                $("#addRecommend").text(recommendName);
                doBoundContent(data.rows[0].ADVICE_HTML_URL);
            }
        </script>
        <%=msBsc.WebUi.Code.QtHtmlGet.GetFloorHtml() %>
    </div>
</body>
</html>
